Combine and read data csv from 02A to 02D
Match and compare isolates’ information to outcome of pairwise competition
The R scripts (sourced in this Rmd) can be run externally to Rstudio.
The R scripts are only for saving R functions, processing raw and temporary data.
All visualization codes are in this Rmd file.
Experiment related scripts
Read pairwise competition outcomes that are determined by colony counts on plates.
Filter out ambiguous pairs and later fill in the data hole by CASEU results.
Map pairs and isolates to the 96-well plate layout
Generate table for manual key-in
Then I manually checked the scanned plate images of competitive pairs. The plate images are saved in folder plate_scan/high_order_plate_scan/ and divided according the experimental batches.
| Batch | Community |
|---|---|
| B2 | 2.6, 2.8, 7.1, 8.4, 10.2, 11.1 |
| C | 11.1 isolate 1 |
| C2 | 11.2 |
| D | 1.2, 1.4, 1.6, 1.7, 4.1, 11.5 |
There are 186x3=558 outcomes of pairwise competitions.
Rows: 558 Columns: 11
── Column specification ───────────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr (2): Experiment, Community
dbl (8): Isolate1, Isolate2, Isolate1Freq, Isolate2Freq, ColonyCount, ColonyCount1, ColonyCount2, D...
lgl (1): Contamination
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
67 pairs without determined outcomes of pairwise competitions will be determined by using CASEU method
186 pair IDs saved in pairs_ID
Rows: 186 Columns: 3
── Column specification ───────────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr (1): Community
dbl (2): Isolate1, Isolate2
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
There are 67 pair-freqs that I don’t know the competitive outcomes by TSA plate counting. The ambiguous pairs will be later examined by using selective media or Sanger sequencing.
Rows: 67 Columns: 7
── Column specification ───────────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr (2): Experiment, Community
dbl (4): Isolate1, Isolate2, Isolate1Freq, Isolate2Freq
lgl (1): Contamination
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
28 pairs
`summarise()` has grouped output by 'Community', 'Isolate1'. You can override using the `.groups` argument.
36 isolates involved in the ambiguous pairs.
Rows: 36 Columns: 4
── Column specification ───────────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr (2): Community, ExpID
dbl (2): Isolate, ID
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 13 Columns: 4
── Column specification ───────────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr (1): Community
dbl (3): CommunitySize, CommunityPairSize, CommunitiyMotifSize
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Each plate has 96 rows and has the following variables
Rows: 1248 Columns: 10
── Column specification ───────────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr (7): Experiment, PlateLayout, Well, Community, Isolate1, Isolate2, Plate
dbl (2): Isolate1Freq, Isolate2Freq
lgl (1): MixIsolate
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
spec_tbl_df [1,248 × 10] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
$ Experiment : chr [1:1248] "Transitivity_B2" "Transitivity_B2" "Transitivity_B2" "Transitivity_B2" ...
$ PlateLayout : chr [1:1248] "933" "933" "933" "933" ...
$ Well : chr [1:1248] "A01" "A02" "A03" "A04" ...
$ MixIsolate : logi [1:1248] TRUE TRUE TRUE TRUE TRUE TRUE ...
$ Community : chr [1:1248] "C11R1" "C11R1" "C11R1" "C11R1" ...
$ Isolate1 : chr [1:1248] "1" "1" "1" "1" ...
$ Isolate2 : chr [1:1248] "1" "2" "3" "4" ...
$ Plate : chr [1:1248] "P1" "P1" "P1" "P1" ...
$ Isolate1Freq: num [1:1248] 50 50 50 50 50 50 50 50 50 50 ...
$ Isolate2Freq: num [1:1248] 50 50 50 50 50 50 50 50 50 50 ...
- attr(*, "spec")=
.. cols(
.. Experiment = col_character(),
.. PlateLayout = col_character(),
.. Well = col_character(),
.. MixIsolate = col_logical(),
.. Community = col_character(),
.. Isolate1 = col_character(),
.. Isolate2 = col_character(),
.. Plate = col_character(),
.. Isolate1Freq = col_double(),
.. Isolate2Freq = col_double()
.. )
- attr(*, "problems")=<externalptr>
Read plate layout by batch
Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> = "none")` instead.
Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> = "none")` instead.
Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> = "none")` instead.
Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> = "none")` instead.
Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> = "none")` instead.
Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> = "none")` instead.
Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> = "none")` instead.
Plate layout that takes different initial frequencies:
P1 is 50%:50%.
P2 and P3 are identical and whose rows are 95% and columns are 5%.
The only exception is plate C11R1 in batch C, which only has one plate.
To determine the relative abundance of of ambiguous pairs in competitive assays.
Use CASEU packages to analyse the Sanger sequencing of mixture culture.
Sanger sequencing protocol preparation. Experimental protocol files are saved in folder output/protocol/
[1] "caseu_calibration.Rmd" "caseu_genewiz.pdf" "caseu_genewiz.Rmd" "caseu_pcr.pdf"
[5] "caseu_pcr.Rmd" "caseu_protocol.pdf" "caseu_protocol.Rmd"
Once we got the mixture Sanger sequences back, we implement analysis by using CASEU (Compositional analysis by Sanger electropherogram unmixing), an R package designed for quantifying relative abundance of Sanger sequences mixture. source code. Install CASEU from bitbucket.
Check out package vignette.
devtools::install_bitbucket('dattamanoshi/caseu') # Install CASEU package
library(CASEU)
Test the example code and data.
Fit Sanger sequences of a mixed culture of four strains. This step may take a few seconds.
library(CASEU)
data('fourStrainExpt') # load an example dataset
results <-
fitSangerMixture(mixture=fourStrainExpt$mixture, # mixture
components = fourStrainExpt$components, # Four individual 16S sequences
verbose=TRUE)
save(results, file = here::here("data/temp/CASEU_test_results1.Rdata"))
Fitted mixture sanger electropherogram output
The plate layout of PCR plate and list of samples are specified in output/protocol/protocol_20190813_Sanger_seq_prep.pdf.
The isolates used in this round is from the list below.
| Isolate | Code | Taxa |
|---|---|---|
| C11R1 isolate 1 | A | Pseudomonas |
| C1R7 isolate 2 | B | Pseudomonas |
| C1R7 isolate 1 | C | Enterobacter |
| C1R7 isolate 7 | D | Raoultella |
Read trace matrices for isolates and mixtures
Rows: 16 Columns: 8
── Column specification ───────────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr (4): MixtureName, Treatment, Isolate1, Isolate2
dbl (4): Isolate1Freq, Isolate2Freq, Isolate1FreqPredicted, Isolate2FreqPredicted
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Plot the expected isolate frequency vs. CASEU predicted frequency
Rows: 16 Columns: 8
── Column specification ───────────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr (4): MixtureName, Treatment, Isolate1, Isolate2
dbl (4): Isolate1Freq, Isolate2Freq, Isolate1FreqPredicted, Isolate2FreqPredicted
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Saving 7.5 x 7.5 in image
The plate layout of PCR plate and list of samples are specified in output/protocol/protocol_20190813_Sanger_seq_prep.pdf. There are 32 samples from pairwise competition and 16 samples from control. Also read Sylvie’s data.
Isolates A B C D in control are the isolates below.
| Isolate | Code | Taxa |
|---|---|---|
| C11R1 isolate 1 | A | Pseudomonas |
| C1R7 isolate 2 | B | Pseudomonas |
| C1R7 isolate 1 | C | Enterobacter |
| C1R7 isolate 7 | D | Raoultella |
In the 12 control synthetic pairs that were made of 4 isolates, compare these pairs’ OD frequencies, colony counts, and CASEU predictions.
Read CASEU predicted frequencies and colony count frequencies in the 12 control pairs.
Rows: 36 Columns: 9
── Column specification ───────────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr (5): MixtureName, User, Treatment, Isolate1, Isolate2
dbl (4): Isolate1Freq, Isolate2Freq, Isolate1FreqPredicted, Isolate2FreqPredicted
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 12 Columns: 10
── Column specification ───────────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr (5): MixtureName, User, Treatment, Isolate1, Isolate2
dbl (5): Isolate1Freq, Isolate2Freq, Isolate1Colony, Isolate2Colony, Dilution
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Join the CASEU predicted result of control pairs in CASEU_pilot2 with the plating result in CASEU_pilot2_plating. The pair CYC_control_50_50_CD has a lot colonies and the colony count of C is just approximation (n=300)
Plot the CASEU predictio vs. colony counts and CASEU prediction vs. OD frequencies
The plate layout of PCR plate and list of samples are specified in output/protocol/protocol_20190923_SequalPrep_Sanger_prep.pdf.
Read trace matrices for isolates and mixtures
Rows: 42 Columns: 9
── Column specification ───────────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr (2): MixtureName, Community
dbl (7): Isolate1Freq, Isolate2Freq, Isolate1, Isolate2, Isolate1FreqPredicted, Isolate2FreqPredict...
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
The plate layout of PCR plate and list of samples are specified in output/protocol/protocol_20191007_Sanger_seq_prep.pdf.
Read trace matrices for isolates and mixtures
Rows: 30 Columns: 9
── Column specification ───────────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr (2): MixtureName, Community
dbl (7): Isolate1Freq, Isolate2Freq, Isolate1, Isolate2, Isolate1FreqPredicted, Isolate2FreqPredict...
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Error propagation theory
Derive isolates’ \(\epsilon\) from T8 data and calculate uncertatinty using error propagation theory
Convert T0 OD frequency \(f^O\) to CFU frequency \(f^C\) and estimate the uncertainty in converted CFU frequencies at T8. Output data/temp/pairs_CFU_freq_uncertainty.csv
This section explains the error propagation theory to estimate the uncertainty in the experimental measurement. There are one or more quantities \(x, y, ...\), with corresponding uncertainties \(\delta x, \delta y, ...\) and that we wish to use the measured values of x and y to calculate the quantity of real interest q. There are three provisional rules:
The square-root rule for counting experiments. The average number of event in time T is \(v\pm\sqrt{v}\)
Uncertainty in sums and differences. The computed mean value \(q=x+y+z-(u+w)\). If the uncertainties in x, …, w are known to be independent and random, then the uncertainty in the computed value of q is the quadratic sum \(\delta q = \sqrt{(\delta x)^2+(\delta y)^2+(\delta z)^2+(\delta u)^2+(\delta w)^2}\) , In any case, \(\delta q\) is never larger than their ordinary sum \(\delta q \leqslant \delta x + \delta y+ \delta z + \delta u + \delta w\)
Uncertainty in product and quotients. \(q=\frac{x\times z}{u\times w}\), then the fractional uncertainty in the computed value q is the sum. If the uncertainties in x, …,w are independent and random, then the fractional uncertainty in q is the sum in quadrature of the original uncertainties, \(\frac{\delta q}{\left|q\right|} = \sqrt{(\frac{\delta x}{\left|x\right|})^2 + \frac{\delta y}{\left|y\right|})^2 +\frac{\delta z}{\left|z\right|})^2 +\frac{\delta u}{\left|u\right|})^2 + \frac{\delta w}{\left|w\right|})^2}\). \(\frac{\delta q}{\left| q \right|} \leqslant \frac{\delta x}{\left| x \right|} + \frac{\delta z}{\left| z \right|} + \frac{\delta u}{\left| u \right|} + \frac{\delta w}{\left| w \right|}\)
Taking these three provisional rules together, the general formula for error propagation takes the following form. Assume the computed quantity is a function of \(x_1, x_2, ..., x_n\), the uncertainty in q is \[\delta q= \sqrt{(\sum{\frac{\partial q}{\partial x_i}}\delta x_i)^2}\]
The uncertainties in each isolate’ epsilon \(\epsilon_A = \frac{OD_A DF_A v_A}{CFU_A}\) comes from four parts:
Dilution factor
The uncertainty in dilution factor comes from the pipetting steps in serial dilution, which include two pipetting volumes:
V1: serial dispensing 10 uL of diluted solution using mP20. It has uncertainty ErrorV1 2 uL.V2: dispense 90 uL of PBS using mP200. It has uncertainty ErrorV2 0.4 uL.For dilution factor \(10^{n}\), it has the the mean \((\frac{V_1}{V_1+V_2})^n\). To obtain the uncertainty in the measured mean, first we caluculate the partial derivatives \(\frac{\partial DF}{\partial V_1}\) and \(\frac{\partial DF}{\partial V_2}\). Then the uncertainty \(\delta DF = \sqrt{(\frac{\partial DF}{\partial V_1}\delta V_1)^2 + (\frac{\partial DF}{\partial V_2}\delta V_2)^2}\)
By using error propagation theroy, the uncertainty in isolates epsilon has the form
\[\delta \epsilon = \sqrt{(\frac{\partial \epsilon}{\partial DF}\delta DF)^2 +(\frac{\partial \epsilon}{\partial CFU}\delta CFU)^2 + (\frac{\partial \epsilon}{\partial OD}\delta OD)^2 + (\frac{\partial \epsilon}{\partial V}\delta V)^2}\]
Rows: 68 Columns: 19
── Column specification ───────────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr (1): Community
dbl (18): Isolate, OD620, ColonyCount, DilutionFactor, CFU, OD, V, ErrorCFU, ErrorOD, ErrorV, DF, E...
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
There are 7 isolates that have either 0 CFU or negative OD value, so they don’t have epsilon values.
The outcome of pairwise competition were determined by comparing the frequency changes between T0 and T8. The T8 frequencies were determined by plating the mature media on rich agar media on which the colonies were counted, whereas T0 frequencies were set to 95/5, 50/50 and 5/95 by mixing two isolate inocula with equal OD. In this section, I will use the OD-CFU conversion coefficient \(\epsilon\) derived from T8 isolate data to convert T0 OD frequencies into CFU frequencies. In specific, the CFU frequency of isolate 1 \(f^C_1\) of a pair can be derived from OD frequencies of isolate 1 and 2 \(f^O_1 ,f^O_2\), which have the relationship below.
\(f^C_1 = \frac{f^o_1\epsilon_1DFv}{f^o_1\epsilon_1DFv + f^o_2\epsilon_2DFv}=\frac{f^o_1\epsilon_1}{f^o_1\epsilon_1 + f^o_2\epsilon_2}\)
where \(\epsilon\) of each isolate was pre-calculated from T8 dataset. DF and v are the same in conversion.
Rows: 1116 Columns: 7
── Column specification ───────────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr (2): Community, Time
dbl (5): Isolate1, Isolate2, Isolate1Freq, Isolate2Freq, Isolate1CFUFreq
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Write CFU frequencies to data/temp/pairs_CFU_freq_uncertainty.csv
Rows: 1116 Columns: 10
── Column specification ───────────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr (3): Community, Time, RawDataType
dbl (6): Isolate1, Isolate2, Isolate1Freq, Isolate2Freq, Isolate1CFUFreq, ErrorIsolate1CFUFreq
lgl (1): Contamination
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Raw data (e.g., CFU counts and CASEU Sanger sequences) are processed and generated into temporary result csv:
02B-CASEU_sanger_seq reads CASEU raw data and outputs temp/CASEU_pilot2.csv and temp/CASEU_pilot3.csv. Both files are CASEU predicted T8 frequencies.
02C-pairs_OD_CFU reads pair_competition and dilution factor data, and it outputs temp/pairs_CFU_freq_uncertainty.csv, which has the T0 OD-converted CFU frequencies and T8 CFU frequencies with uncertainties.
Note that if a pair has both CFU and CASEU result, CASEU will overwrite the CFU result
The script in this section returns a data.frame pairs_freq that has the following variables:
CommunityIsolate1 and Isolate2: indices of isolates within a community. The number of isolate1 is always smaller than isolate2Isolate1InitialODFreq and Isolate2InitialODFreq: 5, 50 or 95. The initial OD frequencies of isolates at T0. This two serve as discrete grouping variables.Time: T0 or T8.Isolate1MeasuredFreq: the measured frequency od isolate1 in the pair.ErrorIsolate1MeasuredFreq: the uncertainty of Isolate1MeasuredFreq.RawDataType: OD, ODtoCFU, CFU, Sanger (CASEU). The raw data type in which the isolate frequencies were measured.Contamination: logical. There are contaminations in three pairs at T8 plates.186x3x2=1116 pair-freq at two time points
Rows: 1116 Columns: 10
── Column specification ──────────────────────────────────────────────────────
Delimiter: ","
chr (3): Community, Time, RawDataType
dbl (6): Isolate1, Isolate2, Isolate1InitialODFreq, Isolate2InitialODFreq,...
lgl (1): Contamination
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
There is one pair-freq that cannot be specified because of contamination.
Plot frequency changes. Output figure of CFU frequency changes to output/figure/pairs_freq_change_uncertainty.pdf
Table of all 27 possible combinations of fitness function and their interaction types
Rows: 27 Columns: 6
── Column specification ───────────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr (3): InteractionType, InteractionTypeFiner, FreqFunc
dbl (3): FromRare, FromMedium, FromAbundant
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Table of interaction types
Rows: 186 Columns: 13
── Column specification ───────────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr (5): Community, FreqFunc, PairIsolate1MeasuredFreqT8, InteractionType, InteractionTypeFiner
dbl (7): Isolate1, Isolate2, FromRare, FromMedium, FromAbundant, From, To
lgl (1): Isolate1Win
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Interaction table
Rows: 32 Columns: 5
── Column specification ───────────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr (4): FromRare, FromMedium, FromAbundant, InteractionType
dbl (1): Count
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Tournament ranks of each isolate. Note that I consider neturality and bistability as draw in the tournament.
Score: the competitive scores of isolate. This score is computed by the formula: number of wins - number of loses + 0 * number of draws.Game: number of pairwise competition the isolate has played. The number of games an isolate plated within a community should be community size minus one.Rank: the ranks based on Score. The ranks range from 1 to the focal community size. Isolates with the same scores in a community are given the same rank.PlotRank: continuous rank for plotting convenience.Correlate competition result with phylogenetic distance
Measure the pairwise phylogenetic distances by difference in 16S base pairs pairs_taxonomy
Biostring::pairwiseAlignment()ape::cophenetic.phylo() on built tree. Try out different tree building methodsRows: 186 Columns: 11
── Column specification ───────────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr (7): Community, Family1, Family2, Genus1, Genus2, PairFermenter, PairFamily
dbl (2): Isolate1, Isolate2
lgl (2): Fermenter1, Fermenter2
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 186 Columns: 5
── Column specification ───────────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr (1): Community
dbl (4): Isolate1, Isolate2, SeqDifference, SeqLength
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 186 Columns: 4
── Column specification ───────────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr (1): Community
dbl (2): Isolate1, Isolate2
lgl (1): PairTreeDistance
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
186 pairs
Rows: 186 Columns: 20
── Column specification ─────────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr (9): Community, InteractionType, InteractionTypeFiner, Family1, Family2, Genus1, Genus2, Pair...
dbl (8): Isolate1, Isolate2, From, To, SeqDifference, SeqLength, T0, T8
lgl (3): Fermenter1, Fermenter2, Isolate1Dominant
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Pairs data.frame melted by T0/T8 and three initial frequencies. 186x3x2=1116
Rows: 1116 Columns: 10
── Column specification ─────────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr (3): Community, Time, RawDataType
dbl (6): Isolate1, Isolate2, Isolate1InitialODFreq, Isolate2InitialODFreq, Isolate1MeasuredFreq, ...
lgl (1): Contamination
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
pairs_meta contains the growth traits of isolates. Note that the order of Isolate1 and Isolate2 in some pairs are flipped such that Isolate1 is always the dominant strain and Isolate 2 is the subdomaint one. Dominant strain is the winner in exclusion pairs, and the more abundant strain (50:50 treatment) in coexistence pairs.
Rows: 186 Columns: 115
── Column specification ─────────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr (13): Community, InteractionType, InteractionTypeFiner, Family1, Family2, Genus1, Genus2, Pai...
dbl (98): Isolate1, Isolate2, From, To, SeqDifference, SeqLength, T0, T8, ID1, r_ketogluconate1, ...
lgl (4): Fermenter1, Fermenter2, Isolate1Dominant, MatchedCS
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Four example outcomes: coexistence and exclusion
The frequencies of coexistence vs. exclusion
Rows: 186 Columns: 18
── Column specification ─────────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr (9): Community, InteractionType, InteractionTypeFiner, Family1, Family2, Genus1, Genus2, Pair...
dbl (6): Isolate1, Isolate2, From, To, SeqDifference, SeqLength
lgl (3): Fermenter1, Fermenter2, Isolate1Dominant
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Four example outcomes: bistability, coexistence, exclusion, and neutrality
Rows: 5 Columns: 7
── Column specification ───────────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr (3): Community, InteractionType, InteractionTypeFiner
dbl (4): Isolate1, Isolate2, From, To
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
`summarise()` has grouped output by 'InteractionTypeFiner'. You can override using the `.groups` argument.
`summarise()` has grouped output by 'PairFermenter'. You can override using the `.groups` argument.
`summarise()` has grouped output by 'PairFamily'. You can override using the `.groups` argument.
`summarise()` has grouped output by 'SeqDifference'. You can override using the `.groups` argument.
Fermenter vs. Interaction type
Family vs. Interaction type
Pairwise 16S differences
Coarsed-grained 16S sequence difference
Relative abundance of fermenter vs. non-fermenter pairs
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Warning: Removed 1 rows containing non-finite values (stat_bin).
Relative abundance of Enterobacteriaceae and Pseudomonadaceae pairs
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Warning: Removed 1 rows containing non-finite values (stat_bin).
`summarise()` has grouped output by 'Community'. You can override using the `.groups` argument.
Fraction of coexistence in 13 communities
Error in grDevices::pdf(file = filename, ..., version = version) :
cannot open file '/Users/chang-yu/Desktop/Lab/invasion-network/output/figure/communities_fraction_coexistence.pdf'
From Higgins2017, the competitive score \(s_i\) of each strain \(i\) was defined as its mean fraction \(f_{ij}\) after co-culture with each of the \(n-1\) competitor strains:
\[s_i=(\sum_{i\neq j}f_{ij})/(n-1)\]
The hierarchy score \(h\) for an n-member netowkr is calculated as:
\[h = \sum_{s_i>s_j}f_{ij}\]
Error: `data` must be a data frame, or other object coercible by `fortify()`, not a character vector.
Run `rlang::last_error()` to see where the error occurred.